package com.ds.infrastructure.hyperspace.container.internal.http;

import io.netty.handler.codec.http.HttpMethod;

import java.util.HashSet;
import java.util.Set;

import static io.netty.handler.codec.http.HttpMethod.*;

/**
 * @author  Weishaoying
 */
public class HttpCors {

    public static final long MAX_AGE = 86400;

    public static final Set<HttpMethod> ALLOW_METHODS = initCorsMethod();

    private static Set<HttpMethod> initCorsMethod() {
        Set<HttpMethod> temMethod = new HashSet<>();
        temMethod.add(OPTIONS);
        temMethod.add(GET);
        temMethod.add(HEAD);
        temMethod.add(POST);
        temMethod.add(PUT);
        temMethod.add(PATCH);
        temMethod.add(DELETE);
        temMethod.add(TRACE);
        temMethod.add(CONNECT);
        return temMethod;
    }
}
